<%@ page import="com.ws.utils.Res" %><%--
  Created by IntelliJ IDEA.
  User: lufei
  Date: 2025/3/22
  Time: 10:31
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java"  isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>图片列表</title>
    <link rel="stylesheet" href="${ pageContext.request.contextPath}/admin/bootstrap/css/bootstrap.min.css">
	<script src="${ pageContext.request.contextPath}/admin/bootstrap/js/jquery-2.1.0.min.js"></script>
	<script src="${ pageContext.request.contextPath}/admin/bootstrap/js/bootstrap.min.js"></script>
    <style>
       .cus-container{
           width: 1368px;
       }
       #user-add .modal-content{
       	padding: 0 20px 20px;	
       }
       #user-edit .modal-content{
       	padding: 0 20px 20px;	
       }
    </style>
</head>
<body>
    <div class="container cus-container">
        <div>
            <div id="search-user" style="float: left; margin: 10px 0px;">
                <form class="form-inline" action="${pageContext.request.contextPath}/image/list" method="post">
                    <div class="form-group">
                        <label for="exampleInputName2">线路名</label>
                        <input type="text" name="route_name" value="${imageVo.route_name}" class="form-control" id="exampleInputName2" >
                    </div>
                    <input type="submit" class="btn btn-default" value="查询">
                </form>
            </div>
        </div>
       <table class="table table-bordered clearfix" id="user-list">
        <thead>
        	<tr class="bg-primary">
	            <th>编号</th>
                <th>线路名</th>
	            <th>图片URL</th>
                <th>操作</th>
	        </tr> 
        </thead> 
        <tbody>
        <c:forEach items="${pageInfo.list}" var="image">
            <tr>
                <td>${image.image_id}</td>
                <td>${image.route.route_name}</td>
                <td>
                    <img src="<%=Res.fileUrl%>${image.image_url}" width="50px" height="50px">
                </td>
                <td>
                    <a class="btn btn-danger btn-xs" href="${pageContext.request.contextPath}/image/delete?image_id=${image.image_id}">删除</a>
                </td>
            </tr>
        </c:forEach>
         </tbody>
      </table>
        <div class="text-center">
            <ul class="pagination">
                <li><a href="${ pageContext.request.contextPath}/image/list?currentPage=1&route_name=${imageVo.route_name}">首页</a></li>
                <li><a href="${ pageContext.request.contextPath}/image/list?currentPage=${ pageInfo.prePage}&route_name=${imageVo.route_name}">上一页</a></li>
                <c:forEach begin="${ pageInfo.navigateFirstPage}" end="${ pageInfo.navigateLastPage}" var="page">
                    <li><a href="${ pageContext.request.contextPath}/image/list?currentPage=${ page}&route_name=${imageVo.route_name}">${page}</a></li>
                </c:forEach>
                <li><a href="${ pageContext.request.contextPath}/image/list?currentPage=${ pageInfo.nextPage}&route_name=${imageVo.route_name}">下一页</a></li>
                <li><a href="${ pageContext.request.contextPath}/image/list?currentPage=${ pageInfo.pages}&route_name=${imageVo.route_name}">末页</a></li>
                <li><a>当前第${ pageInfo.pageNum}页</a></li>
                <li><a>共${ pageInfo.pages}页</a></li>
                <li><a>共${ pageInfo.total}条记录</a></li>
                <li>
                    <a>
                        每页显示：
                        <select name="pageSize" onchange="sel(this.value)">
                            <option value="2" ${pageInfo.pageSize == 2 ? 'selected' : ''}>2</option>
                            <option value="5" ${pageInfo.pageSize == 5 ? 'selected' : ''}>5</option>
                            <option value="10" ${pageInfo.pageSize == 10 ? 'selected' : ''}>10</option>
                            <option value="15" ${pageInfo.pageSize == 15 ? 'selected' : ''}>15</option>
                            <option value="20" ${pageInfo.pageSize == 20 ? 'selected' : ''}>20</option>
                        </select>条
                    </a>
            </ul>
        </div>
     </div>
</body>
</html>
<script>
    function sel(pageSize) {
        location.href = "${ pageContext.request.contextPath}/image/list?currentPage=1&pageSize="+pageSize+"&route_name=${imageVo.route_name}";
    }
</script>